<?php
include ('chek.php');
if($input->get('do')=='set'){
    $title=$input->post('title');
    $intro=$input->post('intro');
    $page_num=$input->post('num');
    //添加数据
    $sql="update setting set title='{$title}' ,intro='{$intro}',s_page='{$page_num}'";
    $is=$db->query($sql);
    if($is){
        header('location:admin.php');
    }
    else{
        die('执行失败！');
    }
}

?>
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8"/>
    <title>系统管理</title>
    <?php
    include ('../headr.php');
    ?>
</head>
<body>
<?php
include ('nav.php');
?>
<div class="container">
    <div class="row">
        <h2>系统管理</h2>
        <hr/>
        <form action="setting.php?do=set" method="post" class="col-xs-6 col-xs-offset-3">
            <div class="form-group">
                <label for="exampleInputEmail1">网站标题</label>
                <input name="title" type="text" class="form-control" id="exampleInputEmail1" placeholder="请输入标题" value="<?php echo $sql_result['title'];?>">
            </div>
            <div class="form-group">
                <label for="exampleInputPassword1">网站介绍</label>
                <input name="intro" type="text" class="form-control" id="exampleInputPassword1" placeholder="请输入" value="<?php echo $sql_result['intro'];?>">
            </div>
            <div class="form-group">
                <label for="exampleInputPassword1">信息显示数</label>
                <input name="num" type="text" class="form-control" id="exampleInputPassword1" placeholder="请输入" value="<?php echo $sql_result['s_page'];?>">
            </div>
            <button type="submit" class="btn btn-default">提交</button>
        </form>
    </div>
</div>
</body>
</html>
